package com.echo.register.task;

import com.echo.register.common.constant.MqConst;
import com.echo.register.common.service.RabbitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName: ScheduleTask
 * @Package: com.echo.register.task
 * @Description: 定时任务
 * @Author 谢同学
 * @Create 2024/1/11 15:18
 * @Version 1.0
 */
@Component
@Slf4j
@EnableScheduling // 定时任务
public class ScheduleTask {
    @Autowired
    private RabbitService rabbitService;

    /**
     * 定时器 每天8点执行
     */
    @Scheduled(cron = "0 0 8 * * ?")
    // @Scheduled(cron = "0/5 * * * * ?")
    public void task1(){
        log.info("定时任务发送。。。");
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8," ");
    }
}
